*************************************************************************************
* "The French Duty of Vigilance Law: Reconciling Human Rights and Firm Profitability"
*
* Replication file
* 
* Date: June 3, 2025
* Contact: bernhard.reinsberg@glasgow.ac.uk | christoph.steinert@ipz.uzh.ch
*
*************************************************************************************


* Data and variables
********************

* Add identifiers 

  use "French_Orbis_data", clear
  ** Proprietary data - not shared on Dataverse **
  
  encode company_name, g(id)
  destring nace_code, replace force 
  sort id year
  xtset id year

  
* Employee numbers

  ** Mean imputation of employee data where missing 
  egen Mempd=mean(employees), by(id)
  egen Mempi=mean(employees_parent), by(id)
  
  g EMPCOM=employees
  replace EMPCOM=Mempd if employees==. 
  g EMPPAR=employees_parent
  replace EMPPAR=Mempi if employees_parent==. 
  
  g lnEmp=ln(EMPCOM)
  
  ** Treatment exposure variables based on employee thresholds
  g postDom=0 if year<2017
  replace postDom=1 if EMPCOM>=5000 & year==2017
  replace postDom=. if EMPCOM==. & year<=2017
  bys id: carryforward postDom, replace
  lab var postDom "Company above domestic threshold - absorbing state"
  
  g postInt=0 if year<2017
  replace postInt=1 if EMPPAR>=10000 & EMPPAR!=. & year==2017
  replace postInt=. if EMPPAR==. & year<=2017
  bys id: carryforward postInt, replace
  lab var postInt "Company above global threshold - absorbing state"

  ** Ever-treated indicator
  egen expDom=max(postDom), by(id)
  lab var expDom "Regulated company: domestic threshold"
  egen expInt=max(postInt), by(id)
  lab var expInt "Regulated company: global threshold"

  
* Profit 

  ** Likelihood of profit 
  g anyProf=profit_loss_pretax>0
  replace anyProf=. if profit_loss_pretax==.

  foreach x in totalass ROE equity profit_per staffexp{
    g ln`x'=asinh(`x')
	}

  ** Profit per employee (with winsorization due to outliers)	
  g lnPPEWin=lnprofit_per
  su lnprofit_per, d
  replace lnPPEWin=`r(p99)' if lnprofit_per>`r(p99)' & lnprofit_per!=.
  replace lnPPEWin=`r(p1)' if lnprofit_per<`r(p1)' & lnprofit_per!=.
 

* Warehouse turnover coefficient (with correction of irregularities)

  g lnWHto=ln(1+turnovercoef_ware)
  lab var lnWHto "(Logged) warehouse turnover coefficient"
 
 
* Revenue from sales ("turnover")
 
  ** Correcting plausible irregularities in the time series 
  g turnover0=turnover_usd
  sort id year 
  di "0 in between xt-1 and xt+1 both not 0"
  replace turnover0=. if turnover0==0 & l.turnover0>0 & f.turnover0>0
  replace turnover0=. if turnover0==0 & f.turnover0>0

  di "turnover close to 0 (multiple of 1k) but 10,000 in t+1"
  replace turnover0=. if turnover0>0 & turnover0<1 & f.turnover0>100 & f.turnover0!=. 
  
  ** Winsorizing outliers 
  su turnover_usd, d
  replace turnover0=`r(p99)' if turnover0>`r(p99)' & turnover_usd!=.
  replace turnover0=`r(p1)' if turnover0<`r(p1)' & turnover_usd!=.
 
  ** Logged turnover
  su turnover_usd turnover0
  g lnturnover0=ln(1+turnover0)
  lab var lnturnover0 "(Logged) revenue from sales"
 
 
 * Political behavior - UNGC membership
 
  g UNGCyear=year(joinedon)
  g UNGCmem0=f.UNGCmem
  replace UNGCmem0=UNGCmem if year==2022
 
 
* Control variables

  global Zorg  lnstaffexp lnequity lntotalass
  global Z  lnEmp lnequity lntotal
  
  
* Define comparison groups at each threshold

  egen _empcom=mean(EMPCOM), by(id)
  egen _emppar=mean(EMPPAR), by(id)

  replace selectdom=1
  replace selectdom=0 if _emppar>=10000 & _empcom<5000 & _emppar!=. & _empcom!=.
  
  replace selectint=1
  replace selectint=0 if _empcom>5000 & _emppar<10000 & _empcom!=. & _emppar!=.

  
* Treatment is '2017 enactment of the law'
******************************************

* Descriptives 

  qui estpost su anyProf staffexp lnWH lnturnover0 UNGCmem0 expDom expInt $Z if selectdom==1|selectint==1
  esttab ., cells("count(fmt(0)) mean(fmt(3)) sd(fmt(3)) min(fmt(3)) max(fmt(3))") noobs style(tex)
  

* Likelihood of profit 

  ** BYS estimator
  g BYSDom=expDom*2017
  replace BYSDom=. if BYSDom==0
  g BYSInt=expInt*2017
  replace BYSInt=. if BYSInt==0
  
  eststo s11: did_imputation anyProf id year BYSDom if selectdom==1, fe(id nace#year) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black")) 
   graph export "BYSDom_anyProf.png", width(800) as(png) replace 
  eststo s12: did_imputation anyProf id year BYSDom if selectdom==1, fe(id nace#year) controls($Z) delta(1) autosample minn(5) allhorizons tol(0.009) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black"))
   graph export "BYSDom_anyProf_Z.png", width(800) as(png) replace 
 
  eststo s13: did_imputation anyProf id year BYSInt if selectint==1, fe(id nace#year) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black"))
   graph export "BYSInt_anyProf.png", width(800) as(png) replace 
  eststo s14: did_imputation anyProf id year BYSInt if selectint==1, fe(id nace#year) controls($Z) delta(1) autosample minn(5) allhorizons tol(0.009) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black"))
   graph export "BYSInt_anyProf_Z.png", width(800) as(png) replace 
  
  ** Table 1 **
  estout s1*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2, fmt(0 0 3)) keep(p* tau*) 
 
 
* Antecedent outcomes 

  ** BYS estimator
  g secgroup=ceil(nace/1000)-1
  eststo s21: did_imputation staffexp id year BYSDom if selectdom==1, fe(id nace#year) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black")) 
   graph export "BYSDom_staffexp.png", width(800) as(png) replace 
  eststo s22: did_imputation lnWHto id year BYSDom if selectdom==1, fe(id secgroup#year) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black")) 
   graph export "BYSDom_WHto.png", width(800) as(png) replace 
  eststo s23: did_imputation lnturnover0 id year BYSDom if selectdom==1, fe(id nace#year) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black")) 
   graph export "BYSDom_revenue.png", width(800) as(png) replace 
  
  eststo s24: did_imputation staffexp id year BYSInt if selectint==1, fe(id secgroup#year) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black"))
   graph export "BYSInt_staffexp.png", width(800) as(png) replace 
  eststo s25: did_imputation lnWHto id year BYSInt if selectint==1, fe(id secgroup#year) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black"))
   graph export "BYSInt_WHto.png", width(800) as(png) replace 
  eststo s26: did_imputation lnturnover0 id year BYSInt if selectint==1, fe(id nace#year) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black"))
   graph export "BYSInt_revenue.png", width(800) as(png) replace 
 
  ** Table 2 **
  estout s2*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2, fmt(0 0 3)) keep(p* tau*)


* Anticipation effects

  g bpostDom=0
  replace bpostDom=1 if year>=2015 & expDom==1
  replace bpostDom=. if year<2015 & EMPCOM==.
  g bpostInt=0
  replace bpostInt=1 if year>=2015 & expInt==1
  replace bpostInt=. if year<2015 & EMPPAR==.
 
  ** BYS estimator at domestic threshold
  eststo s31: did_imputation anyProf id year BYSDom if selectdom==1, fe(id nace#year) shift(3) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(5)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-5(1)8)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black")) 
   graph export "BYSs3_Dom_anyprof.png", replace width(700)
  eststo s32: did_imputation staffexp id year BYSDom if selectdom==1, fe(id nace#year) shift(3) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(5)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-5(1)8)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black")) 
   graph export "BYSs3_Dom_staffexp.png", replace width(700)
  eststo s33: did_imputation lnWHto id year BYSDom if selectdom==1, fe(id secgroup#year) shift(3) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(5)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-5(1)8)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black")) 
   graph export "BYSs3_Dom_warehouse.png", replace width(700)
  eststo s34: did_imputation lnturnover0 id year BYSDom if selectdom==1, fe(id nace#year) shift(3) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(5)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-5(1)8)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black")) 
   graph export "BYSs3_Dom_revenue.png", replace width(700)
  
  ** Table 3 **
  estout s3*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2, fmt(0 0 3)) keep(p* tau*)
  
  ** BYS estimator at global threshold
  eststo s41: did_imputation anyProf id year BYSInt if selectint==1, fe(id sec#year) shift(3) delta(1) autosample minn(5) allhorizons tol(0.009) maxit(50) pretrends(5)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-5(1)8)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black")) 
    graph export "BYSs3_Int_anyprof.png", replace width(700)
  eststo s42: did_imputation staffexp id year BYSInt if selectint==1, fe(id secgroup#year) shift(3) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(5)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-5(1)8)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black")) 
   graph export "BYSs3_Int_staffexp.png", replace width(700)
  eststo s43: did_imputation lnWHto id year BYSInt if selectint==1, fe(id secgroup#year) shift(3) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(5)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-5(1)8)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black")) 
   graph export "BYSs3_Int_warehouse.png", replace width(700)
  eststo s44: did_imputation lnturnover0 id year BYSInt if selectint==1, fe(id secgroup#year) shift(3) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(5)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-5(1)8)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black")) 
   graph export "BYSs3_Int_revenue.png", replace width(700)
  
  ** Table 4 **
  estout s4*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2, fmt(0 0 3)) keep(p* tau*)
  
  
* Corporate political behavior 

  ** BYS estimator  
  eststo s51: did_imputation UNGCmem0 id year BYSDom if selectdom==1, fe(id nace#year) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black")) 
   graph export "BYSDom_UNGC.png", width(800) as(png) replace 
  eststo s52: did_imputation UNGCmem0 id year BYSDom if selectdom==1, fe(id nace#year) controls($Z) delta(1) autosample minn(5) allhorizons tol(0.009) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black"))
   graph export "BYSDom_UNGC_Z.png", width(800) as(png) replace 
  
  eststo s53: did_imputation UNGCmem0 id year BYSInt if selectint==1, fe(id nace#year) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black"))
   graph export "BYSInt_UNGC.png", width(800) as(png) replace 
  eststo s54: did_imputation UNGCmem0 id year BYSInt if selectint==1, fe(id nace#year) controls($Z) delta(1) autosample minn(5) allhorizons tol(0.009) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black"))
   graph export "BYSInt_UNGC_Z.png", width(800) as(png) replace 
  
  ** Table 5 **
  estout s5*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2, fmt(0 0 3)) keep(p* tau*)

  
* Vigilance plan

  g anyvp=nvpl>0 if nvpl!=.
  lab var anyvp "Any vigilance plan"
  
  preserve
  
  collapse (max)postDom postInt nvpl anyvp* ln* nace select*, by(id)
  
  eststo s61: qui reg anyvp postDom if selectdom==1, ro
  eststo s62: qui reghdfe anyvp postDom if selectdom==1, a(nace) vce(ro)
  eststo s63: qui reghdfe anyvp postDom lntotalass lnstaff lnequity if selectdom==1, a(nace) vce(ro)

  ** Table 6 **
  estout s6*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2, fmt(0 0 3)) drop(_con*) 
    
  restore
  

* RepRisk rating   
  
  preserve 
  
  use "data_appended", clear
  ** RepRisk is proprietary data - the dataset here includes the observations that are both in Orbis and RepRisk (N=3,003)

  egen NIX=max(NIpostDom), by(id)
  reghdfe RepRisk NIX##ib2010.year, a(id year) cl(id)
  
  ** Figure A1 **
  coefplot, keep(*X*year*) yline(0) scheme(s1mono) vertical coeflabels(1.NIX#2011.year="2011" 1.NIX#2012.year="2012" 1.NIX#2013.year="2013" 1.NIX#2014.year="2014" 1.NIX#2015.year="2015" 1.NIX#2016.year="2016" 1.NIX#2017.year="2017" 1.NIX#2018.year="2018" 1.NIX#2019.year="2019" 1.NIX#2020.year="2020") level(95 90) xline(7.5, lpattern(dash)) ytitle(Marginal effect on the RepRisk Rating)

  restore   
  
  
* Robustness tests
******************

* BYS estimator with substantive controls added 

  eststo r21: did_imputation staffexp id year BYSDom if selectdom==1, fe(id nace#year) controls($Z) delta(1) autosample minn(5) allhorizons tol(0.009) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black"))
   graph export "BYSDom_staffexp_Z.png", width(800) as(png) replace 
  eststo r22: did_imputation lnWHto id year BYSDom if selectdom==1, fe(id secgroup#year) controls($Z) delta(1) autosample minn(5) allhorizons tol(0.009) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black"))
   graph export "BYSDom_WHto_Z.png", width(800) as(png) replace 
  eststo r23: did_imputation lnturnover0 id year BYSDom if selectdom==1, fe(id nace#year) controls($Z) delta(1) autosample minn(5) allhorizons tol(0.009) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black"))
   graph export "BYSDom_revenue_Z.png", width(800) as(png) replace 

  eststo r24: did_imputation staffexp id year BYSInt if selectint==1, fe(id secgroup#year) controls($Z) delta(1) autosample minn(5) allhorizons tol(0.009) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black"))
   graph export "BYSInt_staffexp_Z.png", width(800) as(png) replace 
  eststo r25: did_imputation lnWHto id year BYSInt if selectint==1, fe(id secgroup#year) controls($Z) delta(1) autosample minn(5) allhorizons tol(0.009) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black"))
   graph export "BYSInt_WHto_Z.png", width(800) as(png) replace 
  eststo r26: did_imputation lnturnover0 id year BYSInt if selectint==1, fe(id nace#year) controls($Z) delta(1) autosample minn(5) allhorizons tol(0.009) maxit(50) pretrends(8)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-8(2)6)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black"))
   graph export "BYSInt_revenue_Z.png", width(800) as(png) replace 
  
  ** Table A2 **
  estout r2*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2, fmt(0 0 3)) keep(p* tau*)


* HDFE regressions: likelihood of profit 

  eststo r31: qui reghdfe anyProf ib2016.year##expDom if selectdom==1, a(id nace##year) cl(id)
  eststo r32: qui reghdfe anyProf $Z ib2016.year##expDom if selectdom==1, a(id nace##year) cl(id)
  eststo r34: qui reghdfe anyProf ib2016.year##expInt if selectint==1, a(id nace##year) cl(id)
  eststo r35: qui reghdfe anyProf $Z ib2016.year##expInt if selectint==1, a(id nace##year) cl(id)
  
  ** Table A3 **
  estout r3*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2, fmt(0 0 3)) keep(20*year*1.expDom 20*year*1.expInt)


* HDFE regressions: antecedent outcomes 

  eststo r41: qui reghdfe staffexpenses ib2016.year##expDom if selectdom==1, a(id nace##year) cl(id)
  eststo r42: qui reghdfe lnWHto ib2016.year##expDom if selectdom==1, a(id nace##year) cl(id)
  eststo r43: qui reghdfe lnturnover0 ib2016.year##expDom if selectdom==1, a(id nace##year) cl(id)

  eststo r44: qui reghdfe staffexpenses ib2016.year##expInt if selectint==1, a(id nace##year) cl(id)
  eststo r45: qui reghdfe lnWHto ib2016.year##expInt if selectint==1, a(id nace##year) cl(id)
  eststo r46: qui reghdfe lnturnover0 ib2016.year##expInt if selectint==1, a(id nace##year) cl(id)

  ** Table A4 **
  estout r4*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2, fmt(0 0 3)) keep(20*year*1.expDom 20*year*1.expInt)

  
* Different base year for employee threshold

  ** Alternative timing for employee measurement  
  g postDom0=0 if year<2017
   g empcom=EMPCOM
   replace empcom=. if year>2016 | year<2015
   egen EMPCOM0=mean(empcom), by(id)
   drop empcom
  replace postDom0=1 if EMPCOM0>=5000 & year==2017
  replace postDom0=. if EMPCOM0==. & year<=2017
  bys id: carryforward postDom0, replace
  lab var postDom0 "Domestic threshold - different base"
  
  g postInt0=0 if year<2017
   g emppar=EMPPAR
   replace emppar=. if year>2016 | year<2015
   egen EMPPAR0=mean(emppar), by(id)
   drop emppar
  replace postInt0=1 if EMPPAR0>=10000 & EMPPAR0!=. & year==2017
  replace postInt0=. if EMPPAR0==. & year<=2017
  bys id: carryforward postInt0, replace
  lab var postInt0 "Global threshold - different base"
 
  egen exp0Dom=max(postDom0), by(id)
  egen exp0Int=max(postInt0), by(id)
  
  eststo r51: qui reghdfe anyProf ib2016.year##exp0Dom if selectdom==1 , a(id nace#year) cl(id)
  eststo r52: qui reghdfe anyProf ib2013.year##exp0Dom if selectdom==1 , a(id nace#year) cl(id)
  eststo r53: qui reghdfe anyProf ib2016.year##exp0Int if selectint==1 , a(id nace#year) cl(id)
  eststo r54: qui reghdfe anyProf ib2013.year##exp0Int if selectint==1 , a(id nace#year) cl(id)
  
  ** Table A5 **
  estout r5*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2, fmt(0 0 3)) keep(*.year#1.*)
 

* HDFE regression: corporate political behavior 

  eststo r61: qui reghdfe UNGCmem0 ib2016.year##expDom if selectdom==1, a(id nace##year) cl(id)
  eststo r62: qui reghdfe UNGCmem0 $Z ib2016.year##expDom if selectdom==1, a(id nace##year) cl(id)
  eststo r64: qui reghdfe UNGCmem0 ib2016.year##expInt if selectint==1, a(id nace##year) cl(id)
  eststo r65: qui reghdfe UNGCmem0 $Z ib2016.year##expInt if selectint==1, a(id nace##year) cl(id)
  
  ** Table A6 **
  estout r6*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2, fmt(0 0 3)) keep(20*year*1.expDom 20*year*1.expInt)

  
* Anticipation effects for corporate political behavior

  ** BYS estimator
  eststo r71: did_imputation UNGCmem0 id year BYSDom if selectdom==1, fe(id nace#year) shift(3) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(5)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-5(1)8)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black")) 
   graph export "BYSs3_Dom_UNGC.png", replace width(700)
  eststo r72: did_imputation UNGCmem0 id year BYSInt if selectint==1, fe(id nace#year) shift(3) delta(1) autosample minn(5) allhorizons tol(0.001) maxit(50) pretrends(5)
  event_plot, graph_opt(xline(0, lcolor("black") lpattern("dash")) yline(0, lcolor("black")) graphregion(color("white")) bgcolor("white")  xtitle("Years since adoption") ytitle("Coefficients") xlabel(-5(1)8)) ciplottype(rcap) lag_ci_opt(color("gray")) lead_ci_opt(color("gray")) lag_opt(color("black")) lead_opt(color("black")) 
   graph export "BYSs3_Int_UNGC.png", replace width(700)
  
  ** Table A7 **
  estout r7*, starlevels(° .1 * .05 ** .01 *** .001) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2, fmt(0 0 3)) keep(p* tau*)

  
